package com.cmwa.solution.utils.spring;

import java.io.IOException;
import java.util.Date;

import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;

import com.cmwa.solution.utils.DateUtils;

/**
 * Description: 日期转换 - "yyyy-MM-dd" 
 */
public class DateYMDJsonDeserializer extends JsonDeserializer<Date> {

	@Override
	public Date deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
		String param = jp.getText();
		return DateUtils.parseDate(param, DateUtils.DATE_FORMAT_yMd_EN);
	}
	
}